package com.jeesite.modules.isys.keys.controller;

import com.jeesite.modules.isys.keys.entity.Reservation;
import com.jeesite.modules.isys.keys.service.IReservationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author XYMTOP
 * @since 2023-11-12
 */
@Controller
@RequestMapping("/mybatisplus/reservation")
public class ReservationController {
    @Qualifier("reservationServiceImpl")
    @Autowired
    private IReservationService reservationService;

    /**
     * 创建预约申请
     * @param reservation 预约实体对象
     * @return ResponseEntity with success message
     */
    @PostMapping("/create")
    public ResponseEntity<String> createReservation(@RequestBody Reservation reservation) {
        reservationService.createReservation(reservation);
        return ResponseEntity.ok("Reservation created successfully");
    }
}
